package com.gamesa.osb.reports.utils;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

import com.gamensa.osb.reports.model.ReportOSB;

public class ReportOSBMapper implements RowMapper<ReportOSB> {
	/**   * Creates a Widget from a ResultSet   */  
	public ReportOSB mapRow(ResultSet rs, int rowNum)  {  
		
		ReportOSB report = new ReportOSB();    
		try    
		{            
			report.setMsgGUID(rs.getString("MSG_GUID"));
			report.setDbTimestamp(rs.getDate("DB_TIMESTAMP"));
			report.setErrorCode(rs.getString("ERROR_CODE"));
			report.setErrorDetails(rs.getString("ERROR_DETAILS"));
			report.setErrorReason(rs.getString("ERROR_REASON"));
			report.setHostName(rs.getString("HOST_NAME"));
			report.setInboundOperation(rs.getString("INBOUND_OPERATION"));
			report.setInboundServiceName(rs.getString("INBOUND_SERVICE_NAME"));
			report.setInboundServiceURI(rs.getString("INBOUND_SERVICE_URI"));
			report.setLocalhostTimestamp(rs.getDate("LOCALHOST_TIMESTAMP"));
			report.setMsgGUID(rs.getString("MSG_GUID"));
			report.setState(rs.getString("STATE"));
			report.setStageName(rs.getString("STAGE_NAME"));
			report.setPipelineName(rs.getString("PIPELINE_NAME"));
			report.setOutboundServiceURI(rs.getString("OUTBOUND_SERVICE_URI"));
			report.setOutboundServiceName(rs.getString("OUTBOUND_SERVICE_NAME"));
			report.setOutboundOperation(rs.getString("OUTBOUND_OPERATION"));
			report.setNode(rs.getString("NODE"));
			report.setMsgLables(rs.getString("MSG_LABELS"));
			
			
		}    
		catch (SQLException e)    
		{      
			e.printStackTrace();
		} catch (Exception e){
			e.printStackTrace();
		}
		
		return report;
	}
}
